home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
436_01
/
indemo.doc
< prev
next >
Wrap
Text File
|
1994-10-07
|
5KB
|
133 lines
Using the Demonstration Program
INDEMO allows you to test INCON, the input control library. It
demonstrates INCON's capabilities in two ways. First, INDEMO itself
uses INCON to gather input into its own menu fields. Second, it uses
the entries you make into those fields to set up a field customized to
your specifications, and allows you to make test entries into it.
When you first run INDEMO, you'll be presented with a menu of all
INCON parameters and flags except the Debug flag. You may navigate
through the menu using [Tab] and [Shift+Tab]. As you move into each
field, a short explanation of its purpose appears at the bottom of the
screen. You must press [Enter] to register entries in parameter
fields because they are confirmed fields. Flag fields are unconfirmed
so, once you've made a valid entry, INDEMO moves on to the next. You
must, however, press [Enter] in the Template field to get to the entry
window.
Entries for Fill and Pad must be the ASCII values of the
characters you want to use; when you press [Enter], INDEMO converts
them to their character representations. ASCII 32 displays as " Sp"
(space), ASCII 255 as "PSp" (phantom space). If you move back into
Fill or Pad, INDEMO converts the character back to its ASCII value.
When you press [Enter] in the Template field, INDEMO creates a
field input window in the bottom third of the screen. At the top of
the window INCON displays the input field you've set up. The next
four lines display input field entries you make, up to the maximum
alpha field width of 255 characters; initially they show the default
input string. Finally, INDEMO displays its Stat Box, showing
parameters in hexadecimal and flags in binary.
During initialization of the test field, you'll see INCON's own
Stat Box flash on and off as INCON displays it just long enough to
capture it in memory. Until you exit the initial field, you may use
[Numpad 5] to toggle INCON's Stat Box, which shows parameters and
flags as modified during initialization. While INCON's Stat Box is
displayed, no entries into the input field are possible; you must
first turn it off with [Numpad 5]. INCON's Stat Box is identified by
name, and by having a double-line border; its video attribute is taken
from the field attribute.
When you exit from the input field (in any of several ways
explained in INCON.DOC), INDEMO displays the vital statistics for your
entry. First is the return value from INCON, followed by the overall
length of the input string, and finally the value of the string you
entered. Non-template integer input is converted to signed long and
floating-point input to double; all other types are converted to
unsigned long. INCON lets you create numeric fields and templates
that extend across an entire screen row, so input may be out of range
for the conversion routines in the standard library.
Using the Demonstration Program 1
Each time you leave the input field, INDEMO presents a "Quit this
test" prompt. If you press [y], INDEMO then asks whether you wish to
quit all tests. If you press any other key, you'll be placed back in
the input field with the default input string, if any, restored. At
the "Quit all" prompt, press [y] to return to DOS; press any other key
to return to the INDEMO menu and continue experimenting with INCON.
INDEMO illustrates how to use INCON's extended-key trapping to
provide special services to users. The menu-navigation service using
[Tab] and [Shift+Tab] has been mentioned. Another is a help screen
that pops up when you press [F1]. The help screen is available at any
time from within the INDEMO menu; to make it available while in the
field entry window, that is, while you're within INCON, you must set
the xKeys flag.
The help routine is a creature of INDEMO; each time it is
displayed, INCON discards any input you've entered into the test
field. That is in keeping with INCON's extended-key trapping, as
explained in INCON.DOC. You could make the help routine part of INCON
itself, but that would require that INCON reserve yet another key, and
add more code to the library. Or, you could alter INCON so that it
saved the state of the input field when it exited via any of the keys
in the extended-key list, but that would require careful handling of
INCON's internal buffers, all of which it now frees prior to exit. In
addition, you'd need to save all of the state information for the
field, including the cursor position.
Using the Demonstration Program 2